package com.general.client.widgets.taperedbox;

import java.util.Iterator;

import com.general.client.basewidget.BaseWidget;
import com.general.client.bundle.CommonBundle;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiTemplate;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.InsertPanel;
import com.google.gwt.user.client.ui.Widget;

public class TaperedBox extends BaseWidget implements InsertPanel, HasWidgets {
	@UiTemplate("TaperedBox.ui.xml")
	interface TaperedBoxWidgetUiBinder extends UiBinder<Widget, TaperedBox> {
	}

	public static TaperedBoxWidgetUiBinder uiBinder = GWT
			.create(TaperedBoxWidgetUiBinder.class);

	@UiField
	FlowPanel container;

	@UiField
	FlowPanel root;

	@UiField
	CommonBundle common;

	public TaperedBox() {
		initWidget(uiBinder.createAndBindUi(this));
		// setElement(root.getElement());
	}

	@Override
	public void add(Widget w) {
		container.add(w);
		// add(w, container.getElement());
	}

	@Override
	public void insert(Widget w, int beforeIndex) {
		// insert(w, container.getElement(), beforeIndex, true);
		container.insert(w, beforeIndex);
	}

	@Override
	public Widget getWidget(int index) {
		return container.getWidget(index);
	}

	@Override
	public int getWidgetCount() {
		return container.getWidgetCount();
	}

	@Override
	public int getWidgetIndex(Widget child) {
		return container.getWidgetIndex(child);
	}

	@Override
	public boolean remove(int index) {
		return container.remove(index);
	}

	@Override
	public void addStyleName(String style) {
		container.addStyleName(style);
	}

	@Override
	public void clear() {
		container.clear();
	}

	@Override
	public Iterator<Widget> iterator() {
		return container.iterator();
	}

	@Override
	public boolean remove(Widget w) {
		return container.remove(w);
	}

}
